package com.mg.admin.service.admin.impl;

import com.mg.admin.bean.admin.ResourceVO;
import com.mg.admin.dao.admin.ResourceMapper;
import com.mg.admin.service.admin.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("resourceServiceImpl")
public class ResourceServiceImpl extends BaseService implements ResourceService {

    @Autowired
    private ResourceMapper resourceMapper;

	@Override
	public List<ResourceVO> findById(String resourceId) {
		List<ResourceVO> resourceDOList = resourceMapper.findById(resourceId);
		return resourceDOList;
	}


	@Override
	public List<ResourceVO> findByParentId(Long id) {
		List<ResourceVO> resourceDOList = resourceMapper.findByParentId(id);
		return resourceDOList;
	}

	@Override
	public ResourceVO finOne(Long id) {
		ResourceVO resourceDO = resourceMapper.findOne(id);
		return resourceDO;
	}

	@Override
	@Transactional
	public void insertOne(ResourceVO resourceVO) {
		resourceMapper.insertOne(resourceVO);
	}

	@Override
	@Transactional
	public void updateOne(ResourceVO resourceVO) {
		resourceMapper.updateOne(resourceVO);
	}

	@Override
	@Transactional
	public void delete(Long id) {
		resourceMapper.delete(id);
	}


}